package com.sc.common.filter;

import javax.servlet.http.HttpSession;

import org.nutz.mvc.ActionContext;
import org.nutz.mvc.ActionFilter;
import org.nutz.mvc.Mvcs;
import org.nutz.mvc.View;
import org.nutz.mvc.view.ServerRedirectView;

import com.sc.SystemConstants;
import com.sc.main.entitty.User;

public class Filter implements ActionFilter {

	@Override
	public View match(ActionContext context) {
		HttpSession session = Mvcs.getHttpSession();
		User user = (User) session.getAttribute(SystemConstants.SESSION_USER);
		if (user == null) {
			return new ServerRedirectView("/");
		}
		return null;
	}

}
